/*
 * Namable.h
 *
 *  Created on: 08.06.2012
 *      Author: sebastian
 */

#ifndef NAMABLE_H_
#define NAMABLE_H_


#include <string>
#include <map>
#include <utility>

class Namable {
private:
	std::string name_;
	//TODO: make it static!
	/**
	 * ajfasldfaksldflkasdfh
	 */
	static std::map<std::string, Namable*> objects_;

	static int idCount_;

public:
	Namable() {};
	Namable(const std::string &name);
	virtual ~Namable(); /* = 0;*/ //should be abstract but that would forbid statics...

	bool setName(const std::string &name); //returns false if name is already used.
	std::string getName() const;

	static int getUniqueId();
	static Namable* getByName(const std::string &name); //returns NULL if fails
};

#endif /* NAMABLE_H_ */
